# 导出异步任务装饰器
from celery import shared_task
from utils.sendemail import simple_send_email
import time
# 记录日志：
import logging

logger = logging.getLogger("django")


# 写函数
@shared_task(name="sendmsg")
def sendmsg(name):
    print(name + "发送短信")
    time.sleep(10)
    print("发送短信成功")


@shared_task(name="sendemail")
def sendmail(subject, message, to_email):
    return simple_send_email(subject, message, to_email)


@shared_task
def sayhello():
    print("说:hello")